#include<iostream>
#include<cstdio>
using namespace std;
typedef long long LL;
const int N = 1e6 + 10;
LL arr[N];
LL d[N];
int n, m;
void add(int l,int r, int v)
{
	d[l] += v;
	d[r + 1] -= v;
}
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &arr[i]);
		add(i, i, arr[i]);
	}
	while (m--) {
		int q, l, r, p;
		scanf("%d%d%d%d", &q, &l, &r, &p);
		if (q == 1) {
			add(l, r, -p);
		}
		else {
			add(l, r, p);
		}
	}
	for (int i = 1; i <= n; i++) {
		d[i] += d[i - 1];
	}
	for (int i = 1; i <= n; i++) {
		d[i] += d[i - 1];
	}
	int l1, r1;
	cin >> l1 >> r1;
	printf("%lld", d[r1] - d[l1 - 1]);
	return 0;
}